/*
*	create by  jack ,20210705
*	
*	描述  
*		  该文件提供了一套线程调用的接口，屏蔽具体实现细节,以达到应用程序可以在不同的平台上联合调试。
*   修改记录：[内容][作者][时间]
*	
*/
#ifndef _SYS_OPERATER_H_
#define _SYS_OPERATER_H_

#include "define_comm.h"

#ifdef __cplusplus
extern "C"{
#endif

/**
 * @brief open a file .
 * @param[in] name:file name flag:mode
 * @return >0  success,file's file descriptor.
 * @return <0 fail.
 */
int sj_open(char *name,char flag);

/**
 * @brief close a file .
 * @param[in] descriptor
 * @return 0  success.
 * @return <0 fail.
 */
int sj_close(int fd);

/**
 * @brief write data .
 * @param[in] fd:descriptor of file;
 * @param[in] data:the point of data;
 * @param[in] len:the len of data;
 * @return >0  success.
 * @return <0 fail.
 */
int sj_write(int fd,char *data,int len);

/**
 * @brief read data .
 * @param[in] fd:descriptor of file;
 * @param[out] data:the point of data;
 * @param[in] len:the  len of hope  ;
 * @return >0  success.
 * @return <0 fail.
 */
int sj_read(int fd,char *data,int len);

/**
 * @brief poll .
 * @param[in] fd:descriptor of file;
 * @param[in] timeout:;
 * @return 0  timeout.
 * @return <0 fail.
 * @return >0 have data.
 */
int sj_poll(int fd,int timeout);

/**
 * @brief   .
 * @param[in] fd:descriptor of file;
 * @param[in] offset:;
 * @param[in] flag:;
 * @return 0  success.
 * @return <0 fail.
 */
int sj_seek(int fd,int offset,char flag);

/**
 * @brief  flush .
 * @param[in] fd:descriptor of file;
 * @return 0  success.
 * @return <0 fail.
 */
int sj_flush(int fd);

/**
 * @brief ioctrl  .
 * @param[in] fd:descriptor of file;
 * @param[cmd] cmd: flag of command;
 * @param[cmd] data:data of command;
 * @return 0  success.
 * @return <0 fail.
 */
int sj_ioctl(int fd,int cmd,char *data);

#ifdef __cplusplus
}
#endif

#endif